Central Article

Creating Offline Web Applications in Macromedia Central


Table of Contents

    1. Introduction
    2. How Central Uses Connection Awareness
    3. Caching Files and Data on the Client Machine
    4. Building a Central Application
    5. Implementing Network Status
    6. Adding Functionality with Application Controls
    7. Final Initiation
    8. Testing Your Central Application

Implementing Network Status

Now create the onNetworkStatus function, which will let your application download and cache files the user requested that were not available offline.

// Handle network status changes
function onNetworkChange(c) {
	
	/* Check connection; if connected, cache files that are waiting in the queue */
	if (c) {
		
		var total = _que.getLength();
		for (var i = 0; i < total; i++) {
			var u = _que.getItemAt(i).label;
			appShell.addToLocalInternetCache(u);
			_dp.addItem(u);
		}
		
		// Clear the queue
		_que.replaceAllItems(null);
	}
}